package com.mes.biz.mapper;

import com.mes.biz.domain.BizOrder;
import com.mes.biz.domain.vo.BizOrderWithProduct;
import com.mes.biz.domain.vo.OrderTrackingVo;
import com.mes.biz.domain.vo.PieceProductionVo;
import com.mes.common.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 销售单Mapper接口
 * @author hwg
 * @email hwg
 * @date 2023-05-15
 */
public interface BizOrderMapper extends BaseMapper<BizOrder>
{

    /**
     * 批量删除销售单
     * @param ids 需要删除的销售单ID集合
     * @return
     */
    public int deleteBizOrderByIds(@Param("ids") String[] ids, @Param("DEL_FLAG_DELETE") String DEL_FLAG_DELETE);

    List<BizOrder> getBizOrderByProjectId(@Param("projectId") String projectId);

    BizOrder getBizOrderByOrderNumber(@Param("orderNumber") String orderNumber);

    int countOrder(@Param("orderNumber") String orderNumber);

    public List<BizOrder> appletProcessList(@Param("orderParams") String orderParams, @Param("orderNumber") String orderNumber,
                                            @Param("processStatus") String processStatus, @Param("userId") String userId);

    public List<BizOrder> AftermarketAppletList(BizOrder bizOrder);

    public List<BizOrder> pickingList(BizOrder bizOrder);

    public List<BizOrder> vehicleDispatchList(@Param("orderParams") String orderParams, @Param("orderNumber") String orderNumber,
                                              @Param("installerStatus") String installerStatus, @Param("installerType") String installerType,
                                              @Param("status") String[] status, @Param("userId") String userId, @Param("shippingStatus") String shippingStatus);

    List listOrderStat(BizOrder bizOrder);

    List<OrderTrackingVo> orderTrackingList(BizOrder bizOrder);

    public List<PieceProductionVo> pieceProductionList(BizOrder bizOrder);

    public BizOrder findById(BizOrder bizOrder);

    /**
     * 查询当天销售单数据
     * @return
     */
    Map<String, Object> getSaleOrderDataByToday();

    /**
     * 查询当天生产数据
     * @return
     */
    Map<String, Object> getProductDataByToday();

    /**
     * 查询当天完成数据
     * @return
     */
    Map<String, Object> getCompleteDataByToday();

    /**
     * 查询当天派单数据
     * @return
     */
    Map<String, Object> getDispatchDataByToday();

    /**
     * 查询当天安装数据
     * @return
     */
    Map<String, Object> getInstallerDataByToday();

    /**
     * 查询当天测量数据
     * @return
     */
    Map<String, Object> getMeasureDataByToday();

    /**
     * 查询本月销售单金额
     * @return
     */
    List<Map<String, Object>> getThisMonthOrderAmountData();

    /**
     * 查询上月销售单金额
     * @return
     */
    List<Map<String, Object>> getLastMonthOrderAmountData();

    /**
     * 查询每月销售数量
     * @return
     */
    List<Map<String, Object>> getSaleOrderDataByMonth();

    /**
     * 根据月份查询销售金额
     * @param dateStr
     * @return
     */
    BigDecimal getSaleOrderAmountByMonth(@Param("dateStr") String dateStr);

    List<BizOrderWithProduct> findListByProcess();

    public int updateByIds(@Param("idList") List<String> idList);
}
